1. Technical Field
This invention relates to a system and method for acquiring a distributed lock or reasserting a lock upon which a lock lease has expired. More specifically, the invention relates to respecting lock mode compatibility in a lock acquisition.
2. Description of the Prior Art
A storage area network (“SAN”) is an increasingly popular storage technology. FIG. 1 is a prior art diagram 10 illustrating a SAN 5 with multiple server nodes 12 and 14, and multiple client nodes 16, 18, and 20. The SAN has metadata space 25 reserved for the server nodes 12 and 14. Each of the client nodes may access an object or multiple objects stored on the file data space 27 of the SAN, but may not access the metadata space. In opening the contents of an existing file object on the storage media in the SAN 5, a client contacts the server node to obtain metadata and locks. Metadata supplies the client with information about a file, such as its attributes and location on storage devices. Locks supply the client with privileges it needs to open a file and read or write data. The server node performs a look-up of metadata information for the requested file within the metadata space 25 of the SAN 5. The server node communicates granted lock information and file metadata to the requesting client node, including the location of all data blocks making up the file. Once the client node holds a distributed lock and knows the data block location(s), the client node can access the data for the file directly from a shared storage device attached to the SAN 5. Accordingly, one advantage of a SAN is that it allows multiple computers to access storage devices, also known as storage media.
In distributed system with shared persistent storage, such as the configuration shown in FIG. 1, modifications to file metadata are coordinated between a client node and a server node using distributed locking techniques. However, problems arise when a client node holding a lock stops communicating with other nodes or when the server node is subject to a failure. The communication failure may be due to the client node experiencing a failure, or a network failure causing the client node holding the lock to be subject to a network partition. For either the failure of the server node or a termination of communication with the client node, problems arise through a loss of any modifications to a file subject to the lock or to the file's metadata. In addition, access to the file subject to the lock may not be possible because of an inability to recover a lock from the node that owns the lock.
Prior art solutions for addressing failure associated with a distributed lock include leased based locks, versioned locks, lock expiration, and lock reassertion techniques. However, these prior art techniques do not always allow a client node to reassert a lock it previously held while maintaining cache consistency. In addition, the prior art techniques do not always deny a client node from reasserting a lock it previously held. Accordingly, there is a need for technique that enables client nodes to reassert a distributed lock while maintaining cache consistency.